package com.teaphy.enclosing;

import java.lang.reflect.Constructor;
import java.lang.reflect.Method;

public class Outer {

	public Outer() {
		// 在构造函数中的内部类
		class InnerConstructor {

		}

		InnerConstructor inner = new InnerConstructor();
		Class clInner = inner.getClass();
		Constructor conInner = clInner.getEnclosingConstructor();
		System.out.println("getEnclosingConstructor() --> " + conInner.getName());
	}

	// 在方法中的内部类
	public void testMethodInner() {
		// 在构造函数中的内部类
		class InnerMethod {

		}

		InnerMethod inner = new InnerMethod();
		Class clInner = inner.getClass();
		Method conInner = clInner.getEnclosingMethod();
		System.out.println("getEnclosingMethod() --> " + conInner.getName());
	}

	public class MemberInner{

	}
}
